/*
 * @Author: 瞿旺兴 18774621495@163.com
 * @Date: 2022-05-13 18:08:44
 * @LastEditors: 瞿旺兴 18774621495@163.com
 * @LastEditTime: 2022-06-17 09:26:59
 * @FilePath: \nien-vue3-admin\src\store\modules\app.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AEopen
 */
import { defineStore } from 'pinia'

const useDesktop = defineStore('useDesktop', {
  state: () => ({
    device: 'desktop',
    sidebar:{
      open: sessionStorage.sidebarStatus ? sessionStorage.sidebarStatus === '1' : true
    }
  }),
  actions:{
    toggleSideBar() {
      // if (this.sidebar.hide) {
      //   return false;
      // }
      this.sidebar.open = !this.sidebar.open
      if (this.sidebar.open) {
        sessionStorage.sidebarStatus = 1
      } else {
        sessionStorage.sidebarStatus = 0
      }
    },
    closeSideBar() {
      sessionStorage.sidebarStatus = 0
      this.sidebar.open = false
    },
    
  }

})
export default useDesktop